<template>
  <UserElementHistory ref="refUserElementHistory"/>
</template>
<script setup>
import {ref} from 'vue';
import UserElementHistory from '@/components/platwork/FlowModelWithHistory/elementHistory/UserElementHistory.vue';
const refFmodal = ref(undefined);
const processInstanceId = ref(undefined);
const refUserElementHistory = ref(undefined);

function setData(element, _processInstanceId) {
  processInstanceId.value = _processInstanceId;
  if (isStartElement(element)) {
  }

  if (isUserElement(element)) {
    let userTaskDefinitionId = getUserTaskId(element);
    refUserElementHistory.value.setData(processInstanceId.value, userTaskDefinitionId);
  }

  if (isEndElement(element)) {
  }
}

function isStartElement(ele) {
  return $(ele).hasClass('start-label');
}

function isUserElement(ele) {
  return $(ele).hasClass('user-label');
}

function isEndElement(ele) {
  return $(ele).hasClass('end-label');
}

function getUserTaskId(ele) {
  return $(ele).attr('data-user-task');
}


defineExpose({
  setData,
});

</script>
<style scoped>

</style>
